package top.lidee.common.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.lidee.common.dto.StoreDto;
import top.lidee.common.enums.QrCodeEnum;
import top.lidee.common.enums.StatusEnum;
import top.lidee.common.enums.YesOrNoEnum;
import top.lidee.common.service.AlipayAuthBackService;
import top.lidee.common.service.MerchantService;
import top.lidee.common.service.StoreService;
import top.lidee.common.service.WeixinService;
import top.lidee.common.service.twice.applet.MtStoreCateService;
import top.lidee.common.service.twice.management.*;
import top.lidee.common.service.twice.popularize.PtpBeesInfoService;
import top.lidee.framework.annoation.OperationServiceLog;
import top.lidee.framework.enums.CommonExceptionEnum;
import top.lidee.framework.exception.BusinessCheckException;
import top.lidee.framework.pagination.PaginationRequest;
import top.lidee.framework.pagination.PaginationResponse;
import top.lidee.framework.result.PageUtils;
import top.lidee.framework.result.ResponseResult;
import top.lidee.module.backendApi.twice.page.Query;
import top.lidee.repository.bean.StoreDistanceBean;
import top.lidee.repository.mapper.MtAliPayAuthBackMapper;
import top.lidee.repository.mapper.MtStoreMapper;
import top.lidee.repository.mapper.MtUserMapper;
import top.lidee.repository.model.MtAlipayAuthBack;
import top.lidee.repository.model.MtMerchant;
import top.lidee.repository.model.MtStore;
import top.lidee.repository.model.twice.pojo.applet.MtStoreCateEntity;
import top.lidee.repository.model.twice.pojo.management.*;
import top.lidee.repository.model.twice.pojo.popularize.PtpBeesInfoEntity;
import top.lidee.repository.model.twice.vo.applet.*;
import top.lidee.repository.model.twice.vo.management.*;
import top.lidee.utils.CopyBean;
import top.lidee.utils.MyCollUtil;
import top.lidee.utils.StringUtil;

import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static top.lidee.framework.constant.AlipayDefaultSettleTypeCon.*;
import static top.lidee.framework.constant.GlobalPattern.IMAGE_URL;
import static top.lidee.framework.constant.SupplierInfoConstant.WAIT;
import static top.lidee.framework.constant.WechatConstant.ENTERPRISE;
import static top.lidee.framework.constant.WechatConstant.TO_THE_PUBLIC;
import static top.lidee.framework.enums.CommonExceptionEnum.NOT_PERMISSION;
import static top.lidee.utils.CustomIdGenerator.getFifteenAUniqueDigit;
import static top.lidee.utils.MapParamsUtil.getKey;
import static top.lidee.utils.MapParamsUtil.getStatus;

/**
 * 店铺管理业务实现类
 * <p>
 * Created by FSQ
 * CopyRight https://www.lidee.top
 */
@Service
@AllArgsConstructor
public class AlipayAuthBackServiceImpl extends ServiceImpl<MtAliPayAuthBackMapper, MtAlipayAuthBack> implements AlipayAuthBackService {

    private MtAliPayAuthBackMapper mtAliPayAuthBackMapper;


    @Override
    public void insert(MtAlipayAuthBack authBack) {
        mtAliPayAuthBackMapper.insert(authBack);
    }

    @Override
    public MtAlipayAuthBack getTokenByStoreId(Integer storeId,String userId) {
        return  mtAliPayAuthBackMapper.getTokenByStoreId(storeId,userId);
    }
}
